HDDS-13943. Improve error message for malformed input in DirstreamClientHandler#9316
HDDS-13943. Improve error message for malformed input in DirstreamClientHandler#9316adoroszlai merged 8 commits intoapache:masterfrom
Conversation
…ntHandler to prevent ArrayIndexOutOfBoundsException
...r-service/src/main/java/org/apache/hadoop/ozone/container/stream/DirstreamClientHandler.java
Outdated
Show resolved
Hide resolved
...rvice/src/test/java/org/apache/hadoop/ozone/container/stream/TestDirstreamClientHandler.java
Outdated
Show resolved
Hide resolved
...rvice/src/test/java/org/apache/hadoop/ozone/container/stream/TestDirstreamClientHandler.java
Show resolved
Hide resolved
|
Thanks @rich7420 for working on this. Left some comments above. Your current test only checks if space is missing or there is an empty file name. Can you please also test the below scenario where the size isn't a number. This ensure that if the size is bad, the application handles it correctly. |
…ozone/container/stream/DirstreamClientHandler.java Co-authored-by: Gargi Jaiswal <134698352+Gargi-jais11@users.noreply.github.com>
|
@Gargi-jais11 thanks for the review! I'll try to complete what you suggested as soon as possible. |
sarvekshayr
left a comment
There was a problem hiding this comment.
Thanks @rich7420 for working on this.
We can parameterize the test and pass in the different invalid strings we want to validate. Also, renaming the method to something more generic like testInvalidFormat would help reduce code duplication.
...r-service/src/main/java/org/apache/hadoop/ozone/container/stream/DirstreamClientHandler.java
Outdated
Show resolved
Hide resolved
|
@sarvekshayr thanks for the review! I'll try it! |
...r-service/src/main/java/org/apache/hadoop/ozone/container/stream/DirstreamClientHandler.java
Show resolved
Hide resolved
|
thanks @sarvekshayr ! I've modified it. |
...rvice/src/test/java/org/apache/hadoop/ozone/container/stream/TestDirstreamClientHandler.java
Outdated
Show resolved
Hide resolved
|
@adoroszlai thanks for the suggestion! |
...rvice/src/test/java/org/apache/hadoop/ozone/container/stream/TestDirstreamClientHandler.java
Show resolved
Hide resolved
|
Thanks @rich7420 for the patch, @Gargi-jais11, @sarvekshayr for the review. |
|
Thanks!!! @Gargi-jais11 , @sarvekshayr and @adoroszlai |
What changes were proposed in this pull request?
This PR added input validation for protocol format in
DirstreamClientHandlerto preventArrayIndexOutOfBoundsException. At the same time , this PR added tests for the situation.What is the link to the Apache JIRA
HDDS-13943
How was this patch tested?
https://github.com/rich7420/ozone/actions/runs/19432005403